package com.jevoly.api;

import com.jevoly.service.FileService;
import com.jevoly.service.WebSocketService;
import com.jevoly.result.ResultMsg;
import com.jevoly.utils.FileUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;

/**
 * 服务器端控制器
 */
@Controller
@RequestMapping("/")
public class ServerController {

    @Autowired
    FileService fileService;

    @GetMapping("")
    public String index() {
        return "server/index";
    }

    @GetMapping("test")
    public String test() {
        return "server/test";
    }

    public void copyDirectoryToServer(String source) {
        String serverDirectory = fileService.getAlbumPath();
        fileService.copyFilesToDirectory(source, serverDirectory);
    }

}
 